Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Input State Window is now force-closed when the device it is inspecting is disconnected #2093

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

Secticide
Copy link
Collaborator

Description

Fixes ISXB-658.

The InputStateWindow currently caches a bunch of state. When a device is disconnected, then reconnected, this state is reused. It is possible - likely based on the specifics of the device - that this will cause the window to memcpy from or into memory no longer owned by the device or the window leading to an editor crash.

To resolve this, I've used the same strategy used for the Input debugger window; when the device is disconnected - the window is force-closed.

Testing status & QA

I tested this locally using a Stadia controller, but it would be great to get some wider testing of devices on this before merging. Although I certainly don't see this as high risk.

Overall Product Risks

  • Complexity: 0
  • Halo Effect: 0

Comments to reviewers

The changes in DrawHexDump were to resolve some spammy null reference exception errors caused by the window. I believe it to be now unlikely that we'd run into a case where null reference exceptions are thrown during the drawing of the window, but there is no harm in doing these checks.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

…eference errors and subscribed to device changed events - closing the window when the device is disconnected (this is done to avoid cached state from hanging around on reconnect)
Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, makes sense to force close due to how the underlying memory is managed. Adding QA to PR.

@ekcoh ekcoh requested a review from stefanunity December 18, 2024 14:42
Copy link
Collaborator

@stefanunity stefanunity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test with DS4, DualSense, Xbox One & Switch Pro controller.
Editor didn't crash, window closed on disconnect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants